﻿@using SimpleIdServer.CredentialIssuer.Domains;
@inject DialogService dialogService

<RadzenStack Gap="1rem">
    <RadzenRow>
        <!-- Source user claim name -->
        <RadzenColumn Size="5">
            <RadzenFormField Class="w-100" Text="@Global.SourceUserClaimName" Variant=Variant.Outlined>
                <ChildContent>
                    <RadzenTextBox @bind-Value=@Claim.SourceUserClaimName></RadzenTextBox>
                </ChildContent>
                <Helper>
                    <RadzenText TextStyle="TextStyle.Caption">@Global.SourceUserClaimNameHelper</RadzenText>
                </Helper>
            </RadzenFormField>
        </RadzenColumn>
        <RadzenColumn Size="2">
            <RadzenStack Style="padding-top: 15px;" JustifyContent="JustifyContent.Center" AlignItems="AlignItems.Center">
                <RadzenIcon Icon="arrow_forward"></RadzenIcon>
            </RadzenStack>
        </RadzenColumn>
        <!-- Name -->
        <RadzenColumn Size="5">
            <RadzenFormField Class="w-100" Text="@Global.Name" Variant=Variant.Outlined>
                <ChildContent>
                    <RadzenTextBox @bind-Value=@Claim.Name></RadzenTextBox>
                </ChildContent>
                <Helper>
                    <RadzenText TextStyle="TextStyle.Caption">@Global.NameHelper</RadzenText>
                </Helper>
            </RadzenFormField>
        </RadzenColumn>
    </RadzenRow>
    <!-- Locale -->
    <RadzenFormField Text="@Global.ClaimValueType" Variant=Variant.Outlined>
        <ChildContent>
            <RadzenDropDown Class="w-100"
                            Data=@SupportedTypes
                            TValue="string"
                            @bind-Value=@Claim.ValueType />
        </ChildContent>
        <Helper>
            <RadzenText TextStyle="TextStyle.Caption">@Global.ClaimValueTypeHelper</RadzenText>
        </Helper>
    </RadzenFormField>
    <!-- Mandatory -->
    <RadzenStack Orientation="Orientation.Horizontal">
        <RadzenCheckBox @bind-Value=@Claim.Mandatory></RadzenCheckBox>
        <RadzenLabel Text=@Global.Mandatory></RadzenLabel>
    </RadzenStack>
    <div>
        <RadzenButton Click=@((evt) => Save()) Variant="Variant.Text">@Global.Save</RadzenButton>
    </div>
</RadzenStack>

@code {
    [Parameter]
    public CredentialConfigurationClaim Claim { get; set; }
    List<string> SupportedTypes => new List<string>
    {
        "string"
    };

    void Save()
    {
        dialogService.Close(Claim);
    }
}